<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Robocup-denayer-project-a: read-only/trunk/source/rijTest.cpp Bron Bestand</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Gegenereerd door Doxygen 1.7.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Zoeken');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

function toggleVisibility(linkObj) {
 var base = linkObj.getAttribute('id');
 var summary = document.getElementById(base + '-summary');
 var content = document.getElementById(base + '-content');
 var trigger = document.getElementById(base + '-trigger');
 if ( hasClass(linkObj,'closed') ) {
   summary.style.display = 'none';
   content.style.display = 'block';
   trigger.src = 'open.png';
   removeClass(linkObj,'closed');
   addClass(linkObj,'opened');
 } else if ( hasClass(linkObj,'opened') ) {
   summary.style.display = 'block';
   content.style.display = 'none';
   trigger.src = 'closed.png';
   removeClass(linkObj,'opened');
   addClass(linkObj,'closed');
 }
 return false;
}
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Hoofd&nbsp;Pagina</span></a></li>
      <li><a href="annotated.html"><span>Klassen</span></a></li>
      <li class="current"><a href="files.html"><span>Bestanden</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
          <span class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Zoeken" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </span><span class="right"></span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;Lijst</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>read-only/trunk/source/rijTest.cpp</h1>  </div>
</div>
<div class="contents">
<a href="rij_test_8cpp.html">Ga naar de documentatie van dit bestand.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="motors_8h.html">motors.h</a>&quot;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="muis_8h.html">muis.h</a>&quot;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="movement_8h.html">movement.h</a>&quot;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="keyword">using namespace </span>std;
<a name="l00017"></a>00017 
<a name="l00018"></a><a class="code" href="rij_test_8cpp.html#a0ddf1224851353fc92bfbff6f499fa97">00018</a> <span class="keywordtype">int</span> <a class="code" href="besturing_test_8cpp.html#a6288eba0f8e8ad3ab1544ad731eb7667">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020         <span class="keywordtype">int</span> compoort;
<a name="l00021"></a>00021         printf(<span class="stringliteral">&quot;Op welke compoort zit de motorsturing? poort: &quot;</span>);
<a name="l00022"></a>00022         scanf(<span class="stringliteral">&quot;%d%*c&quot;</span>,&amp;compoort);
<a name="l00023"></a>00023         <a class="code" href="class_motors.html">Motors</a>* motors=<span class="keyword">new</span> <a class="code" href="class_motors.html">Motors</a>(compoort,19200);
<a name="l00024"></a>00024         <span class="comment">// be sure motors had stopped</span>
<a name="l00025"></a>00025         motors-&gt;<a class="code" href="class_motors.html#a2a03135d58d03d8a82be9be0ceca1236" title="stopMotors">stopMotors</a>();
<a name="l00026"></a>00026         <span class="comment">//robotje.initHardware();</span>
<a name="l00027"></a>00027         
<a name="l00028"></a>00028         <span class="keywordtype">char</span> in;
<a name="l00029"></a>00029         <span class="keywordtype">int</span> speed = 50;
<a name="l00030"></a>00030         
<a name="l00031"></a>00031         printf(<span class="stringliteral">&quot;Snelheid veranderen met h\n&quot;</span>);
<a name="l00032"></a>00032         printf(<span class="stringliteral">&quot;Richting met wasd\n&quot;</span>);
<a name="l00033"></a>00033         scanf(<span class="stringliteral">&quot;%d%*c&quot;</span>,&amp;speed);
<a name="l00034"></a>00034         <span class="keywordflow">if</span>(speed &lt; 0 || speed &gt; 100)
<a name="l00035"></a>00035                 speed = 50;
<a name="l00036"></a>00036         
<a name="l00037"></a>00037         <span class="keywordflow">while</span>(1)
<a name="l00038"></a>00038         {
<a name="l00039"></a>00039                 in=getchar();
<a name="l00040"></a>00040                 <span class="comment">//in = getche();</span>
<a name="l00041"></a>00041                 <span class="keywordflow">switch</span>(in)
<a name="l00042"></a>00042                 {
<a name="l00043"></a>00043                         <span class="keywordflow">case</span> <span class="charliteral">&#39;w&#39;</span> :
<a name="l00044"></a>00044                                 motors-&gt;<a class="code" href="class_motors.html#ae5fe2fd03098baf0fd6e55c1b52a01e9" title="setSpeed">setSpeed</a>(speed,<a class="code" href="motors_8h.html#aecfc8cb31c77ff43036a88e475f0198d">MOTOR_FORWARD</a>,speed,<a class="code" href="motors_8h.html#aecfc8cb31c77ff43036a88e475f0198d">MOTOR_FORWARD</a>);
<a name="l00045"></a>00045                                 <span class="keywordflow">break</span>;
<a name="l00046"></a>00046                         <span class="keywordflow">case</span> <span class="charliteral">&#39;s&#39;</span> :
<a name="l00047"></a>00047                                 motors-&gt;<a class="code" href="class_motors.html#ae5fe2fd03098baf0fd6e55c1b52a01e9" title="setSpeed">setSpeed</a>(speed,<a class="code" href="motors_8h.html#a66ddd712d0c88e8299bdfe5e04d8600f">MOTOR_REVERSE</a>,speed,<a class="code" href="motors_8h.html#a66ddd712d0c88e8299bdfe5e04d8600f">MOTOR_REVERSE</a>);
<a name="l00048"></a>00048                                 <span class="keywordflow">break</span>;
<a name="l00049"></a>00049                         <span class="keywordflow">case</span> <span class="charliteral">&#39;d&#39;</span> :
<a name="l00050"></a>00050                                 motors-&gt;<a class="code" href="class_motors.html#ae5fe2fd03098baf0fd6e55c1b52a01e9" title="setSpeed">setSpeed</a>(speed,<a class="code" href="motors_8h.html#a66ddd712d0c88e8299bdfe5e04d8600f">MOTOR_REVERSE</a>,speed,<a class="code" href="motors_8h.html#aecfc8cb31c77ff43036a88e475f0198d">MOTOR_FORWARD</a>);
<a name="l00051"></a>00051                                 <span class="keywordflow">break</span>;
<a name="l00052"></a>00052                         <span class="keywordflow">case</span> <span class="charliteral">&#39;a&#39;</span> :
<a name="l00053"></a>00053                                 motors-&gt;<a class="code" href="class_motors.html#ae5fe2fd03098baf0fd6e55c1b52a01e9" title="setSpeed">setSpeed</a>(speed,<a class="code" href="motors_8h.html#aecfc8cb31c77ff43036a88e475f0198d">MOTOR_FORWARD</a>,speed,<a class="code" href="motors_8h.html#a66ddd712d0c88e8299bdfe5e04d8600f">MOTOR_REVERSE</a>);
<a name="l00054"></a>00054                                 <span class="keywordflow">break</span>;
<a name="l00055"></a>00055                         <span class="keywordflow">case</span> <span class="charliteral">&#39;h&#39;</span> :
<a name="l00056"></a>00056                                 printf(<span class="stringliteral">&quot;Snelheid [0-100]: &quot;</span>);
<a name="l00057"></a>00057                                 scanf(<span class="stringliteral">&quot;%d%*c&quot;</span>,&amp;speed);
<a name="l00058"></a>00058                                 <span class="keywordflow">if</span>(speed &lt; 0 || speed &gt; 100)
<a name="l00059"></a>00059                                         speed = 50;
<a name="l00060"></a>00060                                 <span class="keywordflow">break</span>;  
<a name="l00061"></a>00061                 }
<a name="l00062"></a>00062                 
<a name="l00063"></a>00063                 usleep(500000);
<a name="l00064"></a>00064                 motors-&gt;<a class="code" href="class_motors.html#ae5fe2fd03098baf0fd6e55c1b52a01e9" title="setSpeed">setSpeed</a>(0,<a class="code" href="motors_8h.html#adaa6428b3f3b92676ba73f27b1ed8035">MOTOR_BRAKE</a>,0,<a class="code" href="motors_8h.html#adaa6428b3f3b92676ba73f27b1ed8035">MOTOR_BRAKE</a>);
<a name="l00065"></a>00065         }
<a name="l00066"></a>00066 } 
<a name="l00067"></a>00067 
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Gegenereerd op Do 19 Mei 2011 10:15:28 voor Robocup-denayer-project-a door&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
